package com.ruoyi.dataserver.api.entity;

import lombok.AccessLevel;
import lombok.Data;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @ProjectName
 * @Package com.lab.dataserver.api.entity
 * @ClassName StatisticsData
 * @Description 统计数据对象实体类
 * @Company lab
 * @Author heff
 * @Date 2020/7/10 14:28
 * @UpdateUser
 * @UpdateDate
 * @UpdateRemark
 * @Version 1.0.0
 */
@Slf4j
@Data
public class StatisticsData implements Serializable {

  private String layer;
  private String layerName;
  private String fieldName;
  private Integer count = 0;
  @Setter(AccessLevel.NONE)
  private Double length = Double.valueOf(0);
  private List<DataDetail> detailList = new ArrayList<>();

  public void setLength(Double length) {
    double temp = Double.valueOf(0);
    if(length != null && !length.equals(temp)){
      temp = Double.parseDouble(String.format("%.2f", length));
    }
    this.length = temp;
  }
}
